package main

import (
	"github.com/sirupsen/logrus"
	golog "log-collection/golog"
)

func main() {

	es_conf := golog.ElasticsearchConf{
		Hosts:              []string{"http://172.31.3.188:9200"},
		Number_of_replicas: 0,
		Number_of_shards:   1,
	}
	logstash_conf_http := golog.LogstashConf{
		Host:      "172.31.3.188",
		Port:      8001,
		Transport: "http",
	}
	//logstash_conf_udp := golog.LogstashConf{
	//	Host:      "172.31.3.188",
	//	Port:      8002,
	//	Transport: "http",
	//}
	//logstash_conf_tcp := golog.LogstashConf{
	//	Host:      "172.31.3.188",
	//	Port:      8003,
	//	Transport: "http",
	//}
	kibana_conf := golog.KibanaConf{
		Host: "172.31.3.188",
		Port: 5601,
	}
	logger, conn := golog.NewELKLog(es_conf, logstash_conf_http, kibana_conf).Init("test").AsyncLogger()
	//logger, conn := golog.NewELKLog(es_conf, logstash_conf_http, kibana_conf).Init("test").SyncLogger()
	if conn != nil {
		defer conn.Close()
	}

	logger.WithFields(logrus.Fields{
		"extra": logrus.Fields{
			"uuid": "123456789",
		},
	}).Info("test1")
	logger.Info("aaaa")
	logger.Warn("bbbb")
	logger.Error("cccc")

}
